import {getToken} from "../utils/authority";
import {stringify} from 'qs';
import request from '../utils/request';


export async function queryDept(params) {
  return request(`/admin/dept/tree?${stringify(params)}`, {
    headers: {
      'Authorization': `Bearer ${getToken()}`,
    },
  });
}


export async function getDept(params) {
  return request('/admin/dept/' + params, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${getToken()}`,
    },
  });
}

export async function addDept(params) {
  return request('/admin/dept/', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${getToken()}`,
    },
    body: params,
  });
}

export async function delDept(params) {
  return request('/admin/dept/' + params, {
    method: 'DELETE',
    headers: {
      'Authorization': `Bearer ${getToken()}`,
    },
  })
}

export async function putDept(params) {
  return request(
    '/admin/dept/', {
      method: 'PUT',
      headers: {
        'Authorization': `Bearer ${getToken()}`,
      },
      body: params,
    })
}

